﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pgInicial.aspx.cs" Inherits="EGuayas.Web.Licenciamiento.promotor.pgInicial" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link  href="~/Resources/css/Style.css"  rel="stylesheet" />
    <!-- Load Ext JS --> 
    <script src="../Resources/js/Global.js"></script>
   <script src="../Resources/js/Usuario.js"></script>
</head>
<body>  
   
        <ext:ResourceManager ID="pgIdCategManager"  runat="server" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
            <Items>
              <%-- Hidden almacena IdPageSession  --%>
              <ext:Hidden Text="" ID="hddIdPageSession" runat="server"></ext:Hidden>
              <ext:Panel ID ="tab1FrmDetail" runat="server"  Title="" ButtonAlign="Center" AnchorVertical="100%">
                    <Loader ID="Loader2"  Url="tabs/pgUndefined.aspx"   Mode="Frame"  AutoLoad="false" Scripts="true" DisableCaching="true" runat="server" Flex="1"  >
                        <LoadMask ShowMask="true" />
                    </Loader>
                     <Buttons>
                         <ext:Button ID="btnNotificar" runat="server" Text="Notificar Cambios"  >
                            <DirectEvents>
                                <Click OnEvent="btnNotificar_Click"  Before="return  pgFn.ValidarForm();"                                
                                    Failure="Ext.Msg.show({ 
                                        title   : 'Error', 
                                        msg     : 'Error', 
                                        minWidth: 200, 
                                        modal   : true, 
                                        icon    : Ext.Msg.ERROR, 
                                        buttons : Ext.Msg.OK 
                                    });">
                                   			    
                                </Click> 
                            </DirectEvents>    
                        </ext:Button>
                      </Buttons>
               </ext:Panel>              
           </Items>
            
       </ext:Viewport>
    
    <ext:XScript ID="XScript1" runat="server">
        <script  type="text/javascript">
            var pgFn = new Object();
            pgFn._id = "pnlContentUrlDinamic";
            pgFn.myPanel = null;
            pgFn.ValidarForm = function () {
                //Obtener numero de documentos a validar
                var objNumDoc = window.parent.frames[0].App.wuc_documentos_numDoc;
                var valMax    = objNumDoc.maxValue;
                var done = objNumDoc.getValue() == valMax;
                if (done == false)
                {
                    Ext.Msg.show({
                        title: 'Error',
                        msg: 'Se requiere que modifique ' + valMax + ' documentos',
                        minWidth: 200,
                        modal: true,
                        icon: Ext.Msg.ERROR,
                        buttons: Ext.Msg.OK
                    });
                }
                else
                {
                    var pnlfrmSettings =  window.parent.frames[0].App.wuc_documentos_frmSettings;
                    if (pnlfrmSettings)
                        pnlfrmSettings.hide();
                    var pnlPromotor =window.parent.frames[0].App.frmPromotor;
                    if (pnlPromotor != null && pnlPromotor.collapsed == true)
                        frmPromotor.expand();
                    var pnlUser = window.parent.frames[0].App.frmPromotor;
                    if (pnlUser != null && pnlUser.collapsed == true)
                        pnlUser.expand();
                    

                }
                return (done);
            };
            pgFn.getIdContentDinamic = function () {
                return (pgFn._id);
            };
            //Mostrar panel detalles
            pgFn.ShowViewDetailPanel = function (_id) {
                var myUrl = "pgPromotor.aspx?idPage=" + App.hddIdPageSession.getValue() + "&idx1=" + _id;
                var myPanelContent= App.tab1FrmDetail;
                pgFn.myPanel = myPanelContent.add(new Ext.Panel({
                   id: pgFn.getIdContentDinamic(),
                   border: false,
                   margins: '5 5 5 0',
                   layout: 'fit',
                   loader:
                    {
                        loadMask:
                        {
                                showMask: true
                        },
                        renderer: "frame",
                        url: myUrl
                    },
                    bodyPadding: 6,
                    closable: false,
                    tbar: [
                    '->',
                    {
                        text: 'Salir',
                        iconCls: '#LockOpen',
                        handler: function () {
                            App.direct.DeleteSession({
                                success: function (result) {
                                    document.location = '../pgLogin.aspx';
                                },
                                eventMask: {
                                    showMask: true,
                                    minDelay: 500
                                }
                             });
                          
                        }
                    }]
                }));
            };           
       </script>
    </ext:XScript>     
</body>


</html>
